<template>
  <section class="sift-item">
    <div class="sift-item-content">
      <img v-lazy="book.cover"/>
      <div class="content">
        <div class="title">{{book.name}}</div>
        <div class="author">{{book.author}}</div>
        <div class="price">￥{{book.price}}</div>
      </div>
    </div>
    <mt-button type="default" @click.stop="challenge">去挑战</mt-button>
  </section>
</template>


<script>
export default {
  props: {
    book: {
      type: Object,
      default: {}
    }
  },
  methods: {
    challenge() {
      this.$router.push({
        path: "bookdetailcity",
        query: { id: this.book.id }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
@import "~@/assets/scss/const.scss";
@import "~@/assets/scss/mixin.scss";

.sift-item {
  background: $app-background-color;
  margin: 20px;
  padding: 10px 0 0;
  border-radius: 10px;
  box-shadow: 0px 4px 24px 0px rgba(216, 216, 216, 0.5);
  text-align: center;
  .sift-item-content {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow: hidden;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
    img {
      display: block;
      width: 90px;
      min-width: 90px;
      height: 120px;
      margin-right: 10px;
      background: #e9e9e9;
    }
    .content {
      flex: 1;
      line-height: 20px;
      font-size: 12px;
      color: #999999;
      font-family: PingFang-SC-Medium;
      line-height: 30px;
      text-align: left;
      min-width: 0;
      .title {
        font-size: 16px;
        color: #1a1a1a;
        margin-bottom: 8px;
        @include ellipsis(1);
      }
      .price {
        color: #eb4c43;
      }
    }
  }
  button {
    width: 100%;
    min-width: 100%;
    font-size: 12px;
    color: #84c7b3;
    background: transparent;
    height: 40px;
    line-height: 40px;
    border-radius: 0;
    margin: 10px auto 0;
    border-top: 1px solid #e9e9e9;
    box-shadow: none;
  }
}
</style>
